﻿<html>
<head>
    <title>Post request sample</title>
    <script type="text/javascript" src="jquery-1.7.min.js"></script>
    <script type="text/javascript">
        var int = self.setInterval("updatePost()", 1000);

        function updatePost() {
            $.ajax({
                url: "/post",
                dataType: 'json',
                type: 'POST',
                data: 'key=Key' + Math.floor(Math.random() * 1000) + '&value=Value' + Math.floor(Math.random() * 1000),
                success: function (data, successCode, jqXHR) {
                    $('span#key').text(data.key);
                    $('span#value').text(data.value);
                },
                error: function (jqXHR, errorType, ex) {
                    $('span#key').text(errorType);
                }
            });
        }
    </script>
</head>
<body>
    The server received the following key: <b><span id="key"></span></b> and <b><span
        id="value"></span></b>!
</body>
</html>
